package util;

import java.io.IOException;
import java.util.Properties;

/**
 * properties 文件工具类
 *
 * Created by J.Chen on 2017/5/22.
 */
public class PropertiesUtil {
    public static String getAnalysisConfValue(String code, String key) {
        Properties properties = new Properties();
        try {
            properties.load(PropertiesUtil.class.getResourceAsStream(String.format("/analysisConf/%s.properties",code)));
            return properties.getProperty(key);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }

    public static String getProperty(String dir, String key) {
        Properties properties = new Properties();
        try {
            properties.load(PropertiesUtil.class.getResourceAsStream(dir));
            return properties.getProperty(key);
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}
